package com.suixinsanren.design.responsibilitychain.demo02;

import java.util.List;
import java.util.Objects;

public abstract class AbsCheckStudent {

    private AbsCheckStudent absCheckStudent;

    public void setAbsCheckStudent(AbsCheckStudent absCheckStudent) {
        this.absCheckStudent = absCheckStudent;
    }

    public void handleCheck(List<Student> studentList) {
        if (Objects.nonNull(studentList) && !studentList.isEmpty()) {
            List<Student> checkPassedStudents = checkStudentInfo(studentList);
            if (Objects.nonNull(absCheckStudent) && Objects.nonNull(checkPassedStudents) && !checkPassedStudents.isEmpty()) {
                absCheckStudent.checkStudentInfo(checkPassedStudents);
            }
        }
    }

    protected abstract List<Student> checkStudentInfo(List<Student> studentList);
}
